package com.kt.delivery.config;

import com.aliyun.ocr_api20210707.Client;
import com.aliyun.teaopenapi.models.Config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @ClassName CrnConfig
 * @Description TODO
 * @Author ghs
 * @Date 2024-04-03 20:59
 * @Version 1.0
 */
@Data
@ConfigurationProperties(prefix = "aliyun")
@Component
public class OcrConfig {

    private String accessKeyId;

    private String accessKeySecret;

    private String endpoint;

    @Bean
    public Client ocrClient(){
        try {

            Client client = new Client(new Config().setAccessKeyId(accessKeyId).setAccessKeySecret(accessKeySecret).setEndpoint(endpoint));
            return client;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
